import React from 'react';
import { Route, Switch, Redirect } from 'react-router-dom'
import {Suspense} from 'react'
export default function RouterView(props) {
    return (
        <Suspense fallback=''>
            <Switch>
                {
                    props.routes.map(item=>{
                        return (
                            <Route key={item.path} path={item.path} component={(props)=>{
                                return <item.component {...props} routes={item.children}></item.component>
                            }}></Route>
                        )
                    })
                }
                <Redirect exact from='/' to='/layout/home' />
                <Redirect exact from='/layout/home' to='/layout/home/tuijian' />
            </Switch>
        </Suspense>
    )
}



